<template>
  <el-input
    :value="value"
    clearable
    :maxlength="configData.maxlength"
    :placeholder="configData.placeholder"
    size="small"
    @input="update"
    @blur="blur"
    @focus="focus"
    @change="change"
  />
</template>
<script>

export default {
  name: 'InputXH',
  props: ['defaultValue', 'configData', 'value'],
  methods: {
    update(val) {
      if (this.configData.type === 'number') {
        val = val ? Number(val.replace(/[^\d]/g, '')) : ''
      }
      this.$emit('input', val)
    },
    blur() {
      this.$emit('blur', this.value)
    },
    focus() {
      this.$emit('focus', this.value)
    },
    change() {
      this.$emit('change', this.value)
    }
  }
}
</script>

<style scoped>
</style>
